<?php
/**
 * Created by PhpStorm.
 * User: lgy
 * Date: 2018/6/30
 * Time: 15:43
 */

namespace app\admin\controller;
use think\Request;
use think\View;
use app\admin\model\Admin AS AdminModel;
class Admin
{
	//展示管理员页面
	public function showAdmin(){
		$view = new View();
		return $view->fetch('admin/admin');
	}
	//获取所有管理员
	public function getAdmin(){
		$result = AdminModel::getAdmin();
		return json($result);
	}
	//添加管理员
	public function addAdmin(){
		$request = Request::instance();
		$params = $request->param();
		$result = AdminModel::addAdmin($params);
		if($result){
			return adminRes('1','添加成功');
		}else{
			return adminRes('0','添加成功，请重试');
		}
	}

}